package com.example.livereplay.common.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.livereplay.common.model.enity.Place;
import com.example.livereplay.common.mapper.PlaceMapper;
import com.example.livereplay.common.service.PlaceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class PlaceServiceImpl extends ServiceImpl<PlaceMapper, Place> implements PlaceService {
    @Resource
    private PlaceMapper placeMapper;
    @Override
    public List<Place> getPlaceByTournamentId(String tournamentId)
    {
        List<Place> places=placeMapper.selectList(new LambdaQueryWrapper<Place>()
                .eq(Place::getTournamentId,tournamentId)
        );
        if(places==null)
        {
            return new ArrayList<>();
        }
        return places;
    }
}
